package com.moon.icoresso.Service;

import com.moon.icoresso.common.utils.StringRedisService;
import com.moon.icoresso.pojo.bo.OauthCodeToRedisBO;
import com.moon.icoresso.pojo.bo.OauthToRedisBO;
import com.moon.icoresso.pojo.dto.OauthTokenDTO;
import com.moon.icoresso.pojo.dto.OauthUserInfo;
import com.moon.icoresso.pojo.dto.UserDTO;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.concurrent.TimeUnit;

/**
 * @ClassName OauthService
 * @Description
 * @Author menbbo
 * @Date 2021/2/12 16:54
 * @Version V1.0
 **/

public interface OauthRedisService {
    /**
     * 根据clientId查询redis中是否存在该clientId
     * @param clientId
     * @return
     */
      OauthToRedisBO getClientId(String clientId);

      String generateUserInfoRedisKey(String userId);

      void saveUserInfo(String key, OauthUserInfo oauthUserInfo, long time, TimeUnit timeUnit);

      void saveOauthCode(String code, String clientId, String tgc,String userInfoKey);

    /**
     * 根据授权码查询
     * @param code
    * @return
     */
      OauthCodeToRedisBO findOauthCodeByCode(String code);

      void saveAccessToken(String grantType,String clientId,String accessToekn,OauthUserInfo oauthUserInfo);

      void saveRefreshToken(String refreshToken,String grantType,String clientId,OauthUserInfo oauthUserInfo);

    /**
     * 删除授权码
     * @param code
     */
      void deleteCode(String code);
}